﻿using System.Windows;
using System.Windows.Controls;
using An_Im.Model;
using Microsoft.Vbe.Interop;
namespace An_Im.UI
{
    /// <summary>
    /// AnImMacroViewControl.xaml 的交互逻辑
    /// </summary>
    public partial class AnImMacroViewControl : UserControl
    {
        public AnImMacroViewControl()
        {
            InitializeComponent();
        }

        private void macroItem_Click(object sender, RoutedEventArgs e)
        {
            var name = (sender as MenuItem).DataContext as string;
            CoreManipulator.App.Run(name); // 运行宏代码
        }

        private void freshButton_Click(object sender, RoutedEventArgs e)
        {
            var vbproj = VBAManipulator.VBProject;
            if (vbproj == null) return;
            macroList.ItemsSource = VBAManipulator.GetMainProcsInCurrentVBProject();


        }
    }
}
